package study.java.jdk.jdk7.s4_try_with_resources;

import lombok.extern.slf4j.Slf4j;
import org.junit.Test;

@Slf4j
public class _01_Test {

    /**
     * 去掉 AutoCloseable close 方法的 throws Exception 就可以去掉 catch
     */
    @Test
    public void test1() {
        try (Resource res1 = new Resource();
             Resource res2 = new Resource()) {
            res1.doSomething();
            res2.doSomething();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}
